#pragma once 
#include "CGame.h"
#include "CMarco.h"
#include "CRebel.h"
#include "Object.h"
#include "QuadTree.h"
#include "CScreen.h"

#include "dsutil.h"

class CMetalSlug: public CGame
{
public:	
	CMetalSlug(HINSTANCE hInstance, LPCSTR GameName, int iMode, bool bIsWindowed, int iFPS);
	~CMetalSlug(void);

	LPD3DXSPRITE m_SpriteHandler;
	LPDIRECT3DSURFACE9 m_BackGround;

	CMarco* Marco;
	CRebel* Rebel;
	CScreen *Screen;
	CQuadTree* Tree;
	vector<Object*> m_Rebel;

	bool mb_IsKeyPressed;
	bool m_bIsAction;
	
	DWORD mdw_LastTime;		//last time render a frame
	DWORD mdw_LastKeyPress;	//last time a key was pressed

protected:	
	void MoveLeft(void);
	void MoveRight(void);
	void JumpUp(void);
	void Stand(void);
	void InitRebel();
	void SetupTree();
	//virtual methods
	virtual void LoadResource(void);
	virtual void RenderFrame(void);
	virtual void ProcessInput(void);
	virtual void OnKeyUp(int iKeyCode);
	virtual void OnKeyDown(int iKeyCode);	
	virtual void UpdateFrame(void);
	//void updateTree();
	//void drawTree();
};


